package com.tpc.control.jpa;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * StatusMapping entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "status_mapping", catalog = "production_control")
public class StatusMapping implements java.io.Serializable {

	// Fields

	private StatusMappingId id;
	private Status status;

	// Constructors

	/** default constructor */
	public StatusMapping() {
	}

	/** full constructor */
	public StatusMapping(StatusMappingId id, Status status) {
		this.id = id;
		this.status = status;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "statusType", column = @Column(name = "status_type", nullable = false, length = 20)),
			@AttributeOverride(name = "statusCode", column = @Column(name = "status_code", nullable = false)),
			@AttributeOverride(name = "statusSap", column = @Column(name = "status_sap", nullable = false, length = 4)) })
	public StatusMappingId getId() {
		return this.id;
	}

	public void setId(StatusMappingId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "status_type", referencedColumnName = "status_type", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "status_code", referencedColumnName = "status_code", nullable = false, insertable = false, updatable = false) })
	public Status getStatus() {
		return this.status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

}